package com.java2_27;

public class Student {
    private String name;
    private int age;

    private Week workDay;

    public Student() {
        this(null,0,Week.MON);
    }

    public Student(String name, int age, Week workDay) {
        this.name = name;
        this.age = age;
        this.workDay = workDay;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return name + " " + age + " " + workDay;
    }

    @Override
    protected void finalize() throws Throwable {
        //可以在该对象回收之前做一些事情（保存数据）
        System.out.println("Students类创建的对象将要被回收了");
    }
}
